package com.wyth.lottery.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wyth.lottery.R;
import com.wyth.lottery.bean.ThreeNoTongBean;

import java.util.List;

/**
 * Created by Administrator on 2017/11/10.
 */

public class ThreeNoTongAdapter extends BaseQuickAdapter<ThreeNoTongBean, BaseViewHolder> {
    /**
     * 0:默认布局  之前的
     * 1:购物车布局
     */
    private int mType = 0;

    public ThreeNoTongAdapter(@Nullable List<ThreeNoTongBean> data) {
        super(R.layout.layout_2tonghao, data);
    }

    public ThreeNoTongAdapter(@Nullable List<ThreeNoTongBean> data, int mType) {
        super(R.layout.layout_3tonghao_shop, data);
        this.mType = mType;
    }

    @Override
    protected void convert(BaseViewHolder helper, ThreeNoTongBean item) {
        if (mType == 0) {
            if (item.isSelect()) {
                helper.setBackgroundRes(R.id.ly_item, R.drawable.text_red_xiao_background);
                helper.setTextColor(R.id.tv_2tonghao, mContext.getResources().getColor(R.color.white));
            } else {
                helper.setBackgroundRes(R.id.ly_item, R.drawable.text_pink_10_background);
                helper.setTextColor(R.id.tv_2tonghao, mContext.getResources().getColor(R.color.red));
            }
            helper.setText(R.id.tv_2tonghao, item.getText());
        } else if (mType == 1) {
            helper.setBackgroundRes(R.id.ly_item, R.drawable.text_red_xiao_background);
            helper.setTextColor(R.id.tv_3notonghao, mContext.getResources().getColor(R.color.white));
            helper.setText(R.id.tv_3notonghao, item.getText());
        }
    }
}
